/**
 * 
 */
package com.chenzehe.alimama.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.WebDriver;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.chenzehe.alimama.html.LoginPage;
import com.chenzehe.java.core.freemarker.HtmlPathHelp;

/**
 * @description
 * @author chenzehe
 * @email hljuczh@163.com
 * @create 2013年11月20日 下午4:14:00
 */
@Controller
public class SearchAction extends BaseAction {
	String username = "hljuczh";
	String password = "";

	@RequestMapping(value = "/qun/nvzhuang.html")
	public String nvzhuang(HttpServletRequest request, ModelMap model) {
		WebDriver webDriver = getWebDriver();
		LoginPage loginPage = new LoginPage(webDriver);
		loginPage.login(username, password);
		return HtmlPathHelp.getHtmlPathFront("nvzhuang");
	}

	@RequestMapping(value = "/search.html")
	public String nanzhuang(HttpServletRequest request, ModelMap model) {
		String key = request.getParameter("key");
		if (StringUtils.isNotBlank(key)) {
			WebDriver webDriver = getWebDriver();
			LoginPage loginPage = new LoginPage(webDriver);			
			loginPage.login(username, password);
			closeWebDriver(webDriver);
		}
		return HtmlPathHelp.getHtmlPathFront("search");
	}

}
